#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QPainter"
#include <QPaintEvent>
#include <stdio.h>
#include <time.h>
#include <QTimer>

myobject::myobject(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::myobject)
{
    time = new QLabel(this);
    time->show();
    time->resize(100,10);
    time->move(0,200);
    this->startTimer(100);
    //ui->setupUi(this);
}

myobject::~myobject()
{
    //delete ui;
}
void myobject::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QPen pen(Qt::DotLine);
    painter.setPen(pen);
    painter.drawText(50,50,"Hello Qt");

    resize(500,500);

    painter.drawLine(50,60,80,60);
}
void myobject::timerEvent(QTimerEvent *)
{
    time->setText(QTime::currentTime().toString());
    //time->setText("123456");
}
